Reapply filter

In DOORS, the GUI provides an option to "Turn filtering on or off".
But I did not come across a "Reapply filtering" option.

How can we programmatically reapply a filter which was created using Tools > Filter > Define option?
bullbala - Wed May 04 02:40:29 EDT 2011

Re: Reapply filter
Peter_Albert - Wed May 04 03:03:05 EDT 2011

As usual, the answer is well hidden in the user manual. You have to read the examples to come across it. Just use

filtering on

to reapply a filter, and

filtering off

to switch it off. Note that it assumes the current Module to be set correctly, so when used in a script, make sure you have the correct current Module.

Regards,

Peter

Re: Reapply filter
bullbala - Wed May 04 04:14:17 EDT 2011

Thanks Peter !

In that case, my next question would be: How can we programmatically turn on the filter without reapplying (as in the GUI option)?

Re: Reapply filter
Peter_Albert - Wed May 04 05:59:11 EDT 2011

bullbala - Wed May 04 04:14:17 EDT 2011
Thanks Peter !

In that case, my next question would be: How can we programmatically turn on the filter without reapplying (as in the GUI option)?

Could you please clarify what for you the difference is between turning on a filter and reapplying a filter? For me, filtering has three aspects: 1) defining a filter, 2) setting the filter and 3) Applying the filter.

In the GUI, the different aspects are not too obvious:

In the filter dialogue box, you can define different filters using the "Advanced" button. None of them are actually applied until you press the "Apply" button.

The DXL equivalent are the numerous filter perms, e.g.

Module m = current 
Filter f = contains(attribute "Object Text", "shall", false)

or

Module m = current
Filter required = contents("shall", false) || contents("must", false)

(all examples copied from the DXL help).

These are only possibilities for filtering.

Now, with

set(f)

you specify which filter exactly shall be used when filtering is turned on, and with

filtering on

you actually apply the filter.

In the GUI, the "Apply" button combines "set" and "filtering on".

Regards,

Peter

Re: Reapply filter
bullbala - Wed May 04 06:32:36 EDT 2011

Thanks for your detailed response and your questions seeking clarification, Peter.

Let me explain with an example.

Let's say that I have 3 objects in the module and the first 2 objects have the word "shall" in the Object Text:

1 - The table shall move ...
2 - The table shall slide ...
3 - The table will roll ...

When I apply a filter (using the GUI) for all objects having the text "shall" in the attribute "Object Text", I get

1 - The table shall move ...
2 - The table shall slide ...

Now, I turn off the filter using the button "Turn filtering on or off" and I see all the objects:

1 - The table shall move ...
2 - The table shall slide ...
3 - The table will roll ...

Next, in the second object I replace "shall" with "will" as follows:

1 - The table shall move ...
2 - The table will slide ...
3 - The table will roll ...

This time, when I turn on the filter using the button "Turn filtering on or off", I still see the old stale results:

1 - The table shall move ...
2 - The table will slide ...

This is because the filter was not reapplied !
My last question was on these lines.
I want to know how we can programmatically turn on the filter without re-applying the filter.

Hope I am clear now :-)

Re: Reapply filter
Peter_Albert - Wed May 04 08:25:30 EDT 2011

bullbala - Wed May 04 06:32:36 EDT 2011
Thanks for your detailed response and your questions seeking clarification, Peter.

Let me explain with an example.

Let's say that I have 3 objects in the module and the first 2 objects have the word "shall" in the Object Text:

1 - The table shall move ...
2 - The table shall slide ...
3 - The table will roll ...

When I apply a filter (using the GUI) for all objects having the text "shall" in the attribute "Object Text", I get

1 - The table shall move ...
2 - The table shall slide ...

Now, I turn off the filter using the button "Turn filtering on or off" and I see all the objects:

1 - The table shall move ...
2 - The table shall slide ...
3 - The table will roll ...

Next, in the second object I replace "shall" with "will" as follows:

1 - The table shall move ...
2 - The table will slide ...
3 - The table will roll ...

This time, when I turn on the filter using the button "Turn filtering on or off", I still see the old stale results:

1 - The table shall move ...
2 - The table will slide ...

This is because the filter was not reapplied !
My last question was on these lines.
I want to know how we can programmatically turn on the filter without re-applying the filter.

Hope I am clear now :-)

I see.

In the GUI, the "Turn filtering on or off" button only runs the "filtering on" or "filtering off" command, with the effect you described. In this case DOORS just remembers which objects matched the filter the last time it was applied. This can also be seen when applying a filter to a layout DXL column. Applying this filter can take several seconds, while turning on/off the filter is always fast.

Now, if you want to re-apply the filter using DXL, you have to

set current Filter
filtering on

which is equivalent to pressing the "Apply" button in the filter GUI,

while filtering on/off via the button in the module window or via

filtering on

does not re-apply the filter.

Regards,

Peter

Re: Reapply filter
bullbala - Wed May 04 09:04:31 EDT 2011

Peter_Albert - Wed May 04 08:25:30 EDT 2011

I see.

In the GUI, the "Turn filtering on or off" button only runs the "filtering on" or "filtering off" command, with the effect you described. In this case DOORS just remembers which objects matched the filter the last time it was applied. This can also be seen when applying a filter to a layout DXL column. Applying this filter can take several seconds, while turning on/off the filter is always fast.

Now, if you want to re-apply the filter using DXL, you have to

set current Filter
filtering on

which is equivalent to pressing the "Apply" button in the filter GUI,

while filtering on/off via the button in the module window or via

filtering on

does not re-apply the filter.

Regards,

Peter

The code:
 

set current Filter
filtering on

 


is exactly what I was looking for !

Thanks so much, Peter.

 

Re: Reapply filter
llandale - Wed May 04 10:45:08 EDT 2011

Peter_Albert - Wed May 04 08:25:30 EDT 2011

I see.

In the GUI, the "Turn filtering on or off" button only runs the "filtering on" or "filtering off" command, with the effect you described. In this case DOORS just remembers which objects matched the filter the last time it was applied. This can also be seen when applying a filter to a layout DXL column. Applying this filter can take several seconds, while turning on/off the filter is always fast.

Now, if you want to re-apply the filter using DXL, you have to

set current Filter
filtering on

which is equivalent to pressing the "Apply" button in the filter GUI,

while filtering on/off via the button in the module window or via

filtering on

does not re-apply the filter.

Regards,

Peter

This didn't make sense to me the first time through. After experimenting: define filter for 'shall', apply filter, turn off, add 'shall' to an object, turn on; yes turning on the filter didn't find the changed object; but re-applying the filter did.

I guess "re-applying" has synonym "re-caclulate" which has more meaning to me.

Your comment about filtering a layout column disturbed me a lot, but then I realized you were using the GUI to filter on the contents of that column. My experiments years ago with messing with filtering INSIDE the layout (IIRC turning showing deleted objects off) failed with exception violations; something to do with not being able to display the value for an object that started displayed but was un-displayed before the layout ended.

  • Louie

Re: Reapply filter
bullbala - Wed May 04 10:59:35 EDT 2011

bullbala - Wed May 04 09:04:31 EDT 2011

The code:
 

set current Filter
filtering on

 


is exactly what I was looking for !

Thanks so much, Peter.

 

Just an observation.

When I was implementing a simple UI with a button to toggle the filtering (i.e., a button with the label "On / Off") as found in the GUI, I used the following perm:
 

bool applyingFiltering (Module)

 


to determine if a filter is currently applied in the module or not.

Surprisingly, when I tested the following piece of code

 

 

 

if(applyingFiltering current Module)
    infoBox "Filtering On"
else
        infoBox "Filtering Off"



I see that the perm always returns false irrespective of whether the filtering is on or off.

Has anybody observed such a behavior or is my use of the perm incorrect ?



 

 

Re: Reapply filter
llandale - Wed May 04 11:45:49 EDT 2011

bullbala - Wed May 04 10:59:35 EDT 2011

Just an observation.

When I was implementing a simple UI with a button to toggle the filtering (i.e., a button with the label "On / Off") as found in the GUI, I used the following perm:
 

bool applyingFiltering (Module)

 


to determine if a filter is currently applied in the module or not.

Surprisingly, when I tested the following piece of code

 

 

 

if(applyingFiltering current Module)
    infoBox "Filtering On"
else
        infoBox "Filtering Off"



I see that the perm always returns false irrespective of whether the filtering is on or off.

Has anybody observed such a behavior or is my use of the perm incorrect ?



 

 

Found a couple other related commands and tried the following. Layout column True or False if Text has Shall. GUI defined filter for that column says "False" and it works. Turned filtering off, added 'Shall' to a new object and I see that the column now says True. Turned filtering back on and yes it still shows that object, even though the column is true (filter not re-calculated/re-applyed).

Ran the following code. The printed results changed true/false meaning that the first function correctly reacted to the 2nd two functions:
.. applyingFiltering(mod)
.. unApplyFiltering(mod)
.. applyFiltering(mod)

But I see that the filter display didn't change; the "applyFiltering" did NOT re-calculate the filter as expected; not did they turn filtering on nor off. Don't see what those last two commands did, if anything.

Here's the code:

void    PrintStuff(Module mod)
{
        string Summary
        Filter fltCurr = current
        if (!null fltCurr)      //
        then Summary = stringOf(mod, fltCurr)  // turn filter into printable string
        else Summary = "No filter defined"
        print "applying:  " applyingFiltering(mod) "\t" Summary "\n"
}
Module mod = current
PrintStuff(mod)
 
if (confirm("Unapply?")) unApplyFiltering(mod)
PrintStuff(mod)
 
if (confirm("Apply?"))   applyFiltering(mod)
PrintStuff(mod)
 
refresh(mod)